<template>
  <div>
    <!-- 三级联动已经注册为全局组件，所以不需要引入，直接使用 -->
    <TypeNav></TypeNav>
    <ListContainer></ListContainer>
    <TodayRecommend></TodayRecommend>
    <Rank></Rank>
    <Like></Like>
    <Floor v-for="(floor,index) in floorList" :key="floor.id" :floor="floor"></Floor>
    <Brand></Brand>
  </div>
</template>

<script>
import ListContainer from "@/pages/Home/ListContainer/ListContainer";
import TodayRecommend from "@/pages/Home/TodayRecommend/TodayRecommend";
import Rank from "@/pages/Home/Rank/Rank";
import Like from "@/pages/Home/Like/Like";
import Floor from "@/pages/Home/Floor/Floor";
import Brand from "@/pages/Home/Brand/Brand";
import { mapState } from "vuex";
export default {
  naem: "Home",
  components: { ListContainer, TodayRecommend, Rank, Like, Floor, Brand },

  mounted() {
    // 组件挂载向mock发送请求获取floor数据
    this.$store.dispatch("getFloorList");
    // console.log(floorList);
    // 获取用户信息在首页展示
    this.$store.dispatch("getUserInfo")
  },
  computed: {
    ...mapState({ floorList: (state) => state.home.floorList }),
  },
};
</script>
